package com.algo.panelmn;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.ToolRunner;

public class RunChainJob2 {

	public static boolean isBatchCaids = false;
	public static final int step1ReducerNum = 150;
	public static final int step2ReducerNum = 30;
	public static final int step3ReducerNum = 10;
	public static final int step4ReducerNum = 10;
	public static void main(String[] args) throws Exception {

		if(args.length > 12)	isBatchCaids = Boolean.parseBoolean(args[13]);
	
		Configuration conf = new Configuration();
		ToolRunner.run(conf , new Method2CookieUVStep1(), args);
		String[] step2args = new String[6];
		step2args[0] = "-Dmapred.job.queue.name=algo";
		step2args[1] = args[8] + "/uuid_sns";
		step2args[2] = args[4];
		step2args[3] = args[6];
		step2args[4] = args[7];
		step2args[5] = args[8] + "/uuid_weight";
		ToolRunner.run(conf, new Method2CookieUVStep2(), step2args);
		String[] step3args = new String[4];
		step3args[0] = "-Dmapred.job.queue.name=algo";
		step3args[1] = args[8] + "/uuid_pv";
		step3args[2] = step2args[5];
		step3args[3] = args[8] + "/pv_weight";
		ToolRunner.run(conf, new Method2CookieUVStep3(), step3args);
		String[] step4args = new String[3];
		step4args[0] = "-Dmapred.job.queue.name=algo";
		step4args[1] = step3args[3];
		step4args[2] = args[8] + "/uuid_uv";
		int res = ToolRunner.run(conf, new Method2CookieUVStep4(), step4args);
		System.exit(res);
	}

}
